<?php


abstract class BaseDatoEstudiante extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $cedula;


	
	protected $usuarioatenea_id;


	
	protected $tipo_ingreso;


	
	protected $email_alterno;


	
	protected $lugar_nacimiento;

	
	protected $aAteneausuario;

	
	protected $collAsignarEsts;

	
	protected $lastAsignarEstCriteria = null;

	
	protected $collConsultas;

	
	protected $lastConsultaCriteria = null;

	
	protected $collSesionAsesorias;

	
	protected $lastSesionAsesoriaCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getCedula()
	{

		return $this->cedula;
	}

	
	public function getUsuarioateneaId()
	{

		return $this->usuarioatenea_id;
	}

	
	public function getTipoIngreso()
	{

		return $this->tipo_ingreso;
	}

	
	public function getEmailAlterno()
	{

		return $this->email_alterno;
	}

	
	public function getLugarNacimiento()
	{

		return $this->lugar_nacimiento;
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::ID;
		}

	} 
	
	public function setCedula($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cedula !== $v) {
			$this->cedula = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::CEDULA;
		}

	} 
	
	public function setUsuarioateneaId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->usuarioatenea_id !== $v) {
			$this->usuarioatenea_id = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::USUARIOATENEA_ID;
		}

		if ($this->aAteneausuario !== null && $this->aAteneausuario->getId() !== $v) {
			$this->aAteneausuario = null;
		}

	} 
	
	public function setTipoIngreso($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tipo_ingreso !== $v) {
			$this->tipo_ingreso = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::TIPO_INGRESO;
		}

	} 
	
	public function setEmailAlterno($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->email_alterno !== $v) {
			$this->email_alterno = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::EMAIL_ALTERNO;
		}

	} 
	
	public function setLugarNacimiento($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->lugar_nacimiento !== $v) {
			$this->lugar_nacimiento = $v;
			$this->modifiedColumns[] = DatoEstudiantePeer::LUGAR_NACIMIENTO;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->cedula = $rs->getString($startcol + 1);

			$this->usuarioatenea_id = $rs->getInt($startcol + 2);

			$this->tipo_ingreso = $rs->getString($startcol + 3);

			$this->email_alterno = $rs->getString($startcol + 4);

			$this->lugar_nacimiento = $rs->getString($startcol + 5);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 6; 
		} catch (Exception $e) {
			throw new PropelException("Error populating DatoEstudiante object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(DatoEstudiantePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			DatoEstudiantePeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(DatoEstudiantePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aAteneausuario !== null) {
				if ($this->aAteneausuario->isModified()) {
					$affectedRows += $this->aAteneausuario->save($con);
				}
				$this->setAteneausuario($this->aAteneausuario);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = DatoEstudiantePeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += DatoEstudiantePeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collAsignarEsts !== null) {
				foreach($this->collAsignarEsts as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collConsultas !== null) {
				foreach($this->collConsultas as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collSesionAsesorias !== null) {
				foreach($this->collSesionAsesorias as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aAteneausuario !== null) {
				if (!$this->aAteneausuario->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aAteneausuario->getValidationFailures());
				}
			}


			if (($retval = DatoEstudiantePeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collAsignarEsts !== null) {
					foreach($this->collAsignarEsts as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collConsultas !== null) {
					foreach($this->collConsultas as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collSesionAsesorias !== null) {
					foreach($this->collSesionAsesorias as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = DatoEstudiantePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getCedula();
				break;
			case 2:
				return $this->getUsuarioateneaId();
				break;
			case 3:
				return $this->getTipoIngreso();
				break;
			case 4:
				return $this->getEmailAlterno();
				break;
			case 5:
				return $this->getLugarNacimiento();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = DatoEstudiantePeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getCedula(),
			$keys[2] => $this->getUsuarioateneaId(),
			$keys[3] => $this->getTipoIngreso(),
			$keys[4] => $this->getEmailAlterno(),
			$keys[5] => $this->getLugarNacimiento(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = DatoEstudiantePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setCedula($value);
				break;
			case 2:
				$this->setUsuarioateneaId($value);
				break;
			case 3:
				$this->setTipoIngreso($value);
				break;
			case 4:
				$this->setEmailAlterno($value);
				break;
			case 5:
				$this->setLugarNacimiento($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = DatoEstudiantePeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setCedula($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setUsuarioateneaId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setTipoIngreso($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setEmailAlterno($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setLugarNacimiento($arr[$keys[5]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(DatoEstudiantePeer::DATABASE_NAME);

		if ($this->isColumnModified(DatoEstudiantePeer::ID)) $criteria->add(DatoEstudiantePeer::ID, $this->id);
		if ($this->isColumnModified(DatoEstudiantePeer::CEDULA)) $criteria->add(DatoEstudiantePeer::CEDULA, $this->cedula);
		if ($this->isColumnModified(DatoEstudiantePeer::USUARIOATENEA_ID)) $criteria->add(DatoEstudiantePeer::USUARIOATENEA_ID, $this->usuarioatenea_id);
		if ($this->isColumnModified(DatoEstudiantePeer::TIPO_INGRESO)) $criteria->add(DatoEstudiantePeer::TIPO_INGRESO, $this->tipo_ingreso);
		if ($this->isColumnModified(DatoEstudiantePeer::EMAIL_ALTERNO)) $criteria->add(DatoEstudiantePeer::EMAIL_ALTERNO, $this->email_alterno);
		if ($this->isColumnModified(DatoEstudiantePeer::LUGAR_NACIMIENTO)) $criteria->add(DatoEstudiantePeer::LUGAR_NACIMIENTO, $this->lugar_nacimiento);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(DatoEstudiantePeer::DATABASE_NAME);

		$criteria->add(DatoEstudiantePeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setCedula($this->cedula);

		$copyObj->setUsuarioateneaId($this->usuarioatenea_id);

		$copyObj->setTipoIngreso($this->tipo_ingreso);

		$copyObj->setEmailAlterno($this->email_alterno);

		$copyObj->setLugarNacimiento($this->lugar_nacimiento);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getAsignarEsts() as $relObj) {
				$copyObj->addAsignarEst($relObj->copy($deepCopy));
			}

			foreach($this->getConsultas() as $relObj) {
				$copyObj->addConsulta($relObj->copy($deepCopy));
			}

			foreach($this->getSesionAsesorias() as $relObj) {
				$copyObj->addSesionAsesoria($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new DatoEstudiantePeer();
		}
		return self::$peer;
	}

	
	public function setAteneausuario($v)
	{


		if ($v === null) {
			$this->setUsuarioateneaId(NULL);
		} else {
			$this->setUsuarioateneaId($v->getId());
		}


		$this->aAteneausuario = $v;
	}


	
	public function getAteneausuario($con = null)
	{
				include_once 'lib/model/om/BaseAteneausuarioPeer.php';

		if ($this->aAteneausuario === null && ($this->usuarioatenea_id !== null)) {

			$this->aAteneausuario = AteneausuarioPeer::retrieveByPK($this->usuarioatenea_id, $con);

			
		}
		return $this->aAteneausuario;
	}

	
	public function initAsignarEsts()
	{
		if ($this->collAsignarEsts === null) {
			$this->collAsignarEsts = array();
		}
	}

	
	public function getAsignarEsts($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseAsignarEstPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collAsignarEsts === null) {
			if ($this->isNew()) {
			   $this->collAsignarEsts = array();
			} else {

				$criteria->add(AsignarEstPeer::ESTUDIANTE_ID, $this->getId());

				AsignarEstPeer::addSelectColumns($criteria);
				$this->collAsignarEsts = AsignarEstPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(AsignarEstPeer::ESTUDIANTE_ID, $this->getId());

				AsignarEstPeer::addSelectColumns($criteria);
				if (!isset($this->lastAsignarEstCriteria) || !$this->lastAsignarEstCriteria->equals($criteria)) {
					$this->collAsignarEsts = AsignarEstPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastAsignarEstCriteria = $criteria;
		return $this->collAsignarEsts;
	}

	
	public function countAsignarEsts($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseAsignarEstPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(AsignarEstPeer::ESTUDIANTE_ID, $this->getId());

		return AsignarEstPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addAsignarEst(AsignarEst $l)
	{
		$this->collAsignarEsts[] = $l;
		$l->setDatoEstudiante($this);
	}


	
	public function getAsignarEstsJoinAteneausuario($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseAsignarEstPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collAsignarEsts === null) {
			if ($this->isNew()) {
				$this->collAsignarEsts = array();
			} else {

				$criteria->add(AsignarEstPeer::ESTUDIANTE_ID, $this->getId());

				$this->collAsignarEsts = AsignarEstPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		} else {
									
			$criteria->add(AsignarEstPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastAsignarEstCriteria) || !$this->lastAsignarEstCriteria->equals($criteria)) {
				$this->collAsignarEsts = AsignarEstPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		}
		$this->lastAsignarEstCriteria = $criteria;

		return $this->collAsignarEsts;
	}

	
	public function initConsultas()
	{
		if ($this->collConsultas === null) {
			$this->collConsultas = array();
		}
	}

	
	public function getConsultas($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
			   $this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				ConsultaPeer::addSelectColumns($criteria);
				$this->collConsultas = ConsultaPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				ConsultaPeer::addSelectColumns($criteria);
				if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
					$this->collConsultas = ConsultaPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastConsultaCriteria = $criteria;
		return $this->collConsultas;
	}

	
	public function countConsultas($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

		return ConsultaPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addConsulta(Consulta $l)
	{
		$this->collConsultas[] = $l;
		$l->setDatoEstudiante($this);
	}


	
	public function getConsultasJoinDiagnostico($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinDiagnostico($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinDiagnostico($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}


	
	public function getConsultasJoinAteneausuario($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}


	
	public function getConsultasJoinMotivoConsulta($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinMotivoConsulta($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinMotivoConsulta($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}


	
	public function getConsultasJoinTrastorno($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinTrastorno($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinTrastorno($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}


	
	public function getConsultasJoinHistoriaPsicologica($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinHistoriaPsicologica($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinHistoriaPsicologica($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}


	
	public function getConsultasJoinCita($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseConsultaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collConsultas === null) {
			if ($this->isNew()) {
				$this->collConsultas = array();
			} else {

				$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collConsultas = ConsultaPeer::doSelectJoinCita($criteria, $con);
			}
		} else {
									
			$criteria->add(ConsultaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastConsultaCriteria) || !$this->lastConsultaCriteria->equals($criteria)) {
				$this->collConsultas = ConsultaPeer::doSelectJoinCita($criteria, $con);
			}
		}
		$this->lastConsultaCriteria = $criteria;

		return $this->collConsultas;
	}

	
	public function initSesionAsesorias()
	{
		if ($this->collSesionAsesorias === null) {
			$this->collSesionAsesorias = array();
		}
	}

	
	public function getSesionAsesorias($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSesionAsesoriaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSesionAsesorias === null) {
			if ($this->isNew()) {
			   $this->collSesionAsesorias = array();
			} else {

				$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

				SesionAsesoriaPeer::addSelectColumns($criteria);
				$this->collSesionAsesorias = SesionAsesoriaPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

				SesionAsesoriaPeer::addSelectColumns($criteria);
				if (!isset($this->lastSesionAsesoriaCriteria) || !$this->lastSesionAsesoriaCriteria->equals($criteria)) {
					$this->collSesionAsesorias = SesionAsesoriaPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastSesionAsesoriaCriteria = $criteria;
		return $this->collSesionAsesorias;
	}

	
	public function countSesionAsesorias($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseSesionAsesoriaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

		return SesionAsesoriaPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addSesionAsesoria(SesionAsesoria $l)
	{
		$this->collSesionAsesorias[] = $l;
		$l->setDatoEstudiante($this);
	}


	
	public function getSesionAsesoriasJoinAteneausuario($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSesionAsesoriaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSesionAsesorias === null) {
			if ($this->isNew()) {
				$this->collSesionAsesorias = array();
			} else {

				$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collSesionAsesorias = SesionAsesoriaPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		} else {
									
			$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastSesionAsesoriaCriteria) || !$this->lastSesionAsesoriaCriteria->equals($criteria)) {
				$this->collSesionAsesorias = SesionAsesoriaPeer::doSelectJoinAteneausuario($criteria, $con);
			}
		}
		$this->lastSesionAsesoriaCriteria = $criteria;

		return $this->collSesionAsesorias;
	}


	
	public function getSesionAsesoriasJoinTurno($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSesionAsesoriaPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSesionAsesorias === null) {
			if ($this->isNew()) {
				$this->collSesionAsesorias = array();
			} else {

				$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

				$this->collSesionAsesorias = SesionAsesoriaPeer::doSelectJoinTurno($criteria, $con);
			}
		} else {
									
			$criteria->add(SesionAsesoriaPeer::ESTUDIANTE_ID, $this->getId());

			if (!isset($this->lastSesionAsesoriaCriteria) || !$this->lastSesionAsesoriaCriteria->equals($criteria)) {
				$this->collSesionAsesorias = SesionAsesoriaPeer::doSelectJoinTurno($criteria, $con);
			}
		}
		$this->lastSesionAsesoriaCriteria = $criteria;

		return $this->collSesionAsesorias;
	}

} 